using System.Linq;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using CMSSample.Models;
using System.Threading.Tasks;
namespace CMSSample.Controllers
{
    public class InfoController : Controller
    {
        private readonly InfoContext context;

        public InfoController(InfoContext context)
        {
            this.context = context;
        }

        public async Task<IActionResult> Index()
        {
            var infoviewmodel = new InfoViewModel(context);

            infoviewmodel.Books = context.Book.ToList();

            //context.Book.AddRange(context.SeedBook());

            //await context.SaveChangesAsync();

            return View(infoviewmodel);
        }
    }
}